home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Learning Director.dcr / Internal_12_MS_Playback.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  6.9 KB  |  252 lines

  1. on GetAutoChannels
  2.   set autoChannels to GG(#gAutoChannels)
  3.   if voidp(autoChannels) then
  4.     set autoChannels to [:]
  5.     setaProp(autoChannels, #lessonRTF, 39)
  6.     setaProp(autoChannels, #lessonShadowRTF, 37)
  7.     setaProp(autoChannels, #listTextFIELD, 38)
  8.     setaProp(autoChannels, #vscrollBITMAP, 40)
  9.     setaProp(autoChannels, #thumbBITMAP, 41)
  10.     setaProp(autoChannels, #upScrollBITMAP, 42)
  11.     setaProp(autoChannels, #downScrollBITMAP, 43)
  12.     setaProp(autoChannels, #navBarBITMAP, 46)
  13.     SG(#gAutoChannels, autoChannels)
  14.   end if
  15.   return autoChannels
  16. end
  17.  
  18. on ClearAutoChannelPuppets
  19.   set autoChannels to GG(#gAutoChannels)
  20.   if not voidp(autoChannels) then
  21.     repeat with channelNum in autoChannels
  22.       puppetSprite(channelNum, 0)
  23.     end repeat
  24.   end if
  25. end
  26.  
  27. on IsListLineVisible scroller, whichLine
  28.   set topLine to getTopLine(scroller)
  29.   set listWrapList to GG(#gLineWrapList)
  30.   set count to 0
  31.   repeat with lineNum = topLine to whichLine
  32.     set count to count + getAt(listWrapList, lineNum)
  33.   end repeat
  34.   return count <= getNumVisibleLines(scroller)
  35. end
  36.  
  37. on MD.Lesson
  38.   set autoChannels to GetAutoChannels()
  39.   set channelSym to getOne(autoChannels, the clickOn)
  40.   case channelSym of
  41.     #listTextFIELD:
  42.       set possibleTN to "T" & string(GG(#gLessonNum))
  43.       if the frameLabel <> possibleTN then
  44.         set hit to inText(GG(#gActiveScroller))
  45.         if hit then
  46.           set stepNum to getSelectedLine(GG(#gActiveScroller)) - 1
  47.           if stepNum <> GG(#gStepNum) then
  48.             go(label(GG(#gLessonPrefix) & string(stepNum)))
  49.           end if
  50.         end if
  51.       end if
  52.     otherwise:
  53.       pass()
  54.   end case
  55. end
  56.  
  57. on MD.Menu
  58.   set autoChannels to GetAutoChannels()
  59.   set channelSym to getOne(autoChannels, the clickOn)
  60.   case channelSym of
  61.     #listTextFIELD:
  62.       set hit to inText(GG(#gActiveScroller))
  63.       if hit then
  64.         DoCloseButton()
  65.       end if
  66.     otherwise:
  67.       pass()
  68.   end case
  69. end
  70.  
  71. on MD.MenuNavBar
  72.   set mousePos to the clickLoc
  73.   if GG(#gIsSmallWindow) then
  74.     set mousePos to mousePos + point(0, GG(#gDiffSize))
  75.   end if
  76.   if inside(mousePos, rect(130, 240, 200, 252)) then
  77.     set hit to DoButtonHit(#be_pushButton, the clickOn, "NavBar3_Close", "NavBar3", "DoCloseButton", EMPTY, EMPTY, "mdown.aif", "mdown.aif", 0)
  78.     puppetSprite(the clickOn, 0)
  79.   end if
  80. end
  81.  
  82. on MD.LessonNavBar
  83.   if the castNum of sprite 46 = the number of member "NavBar2" then
  84.     set hasTryItButton to 1
  85.   else
  86.     set hasTryItButton to 0
  87.   end if
  88.   set mousePos to the clickLoc
  89.   if GG(#gIsSmallWindow) then
  90.     set mousePos to mousePos + point(0, GG(#gDiffSize))
  91.   end if
  92.   set inCast to EMPTY
  93.   if hasTryItButton then
  94.     if inside(mousePos, rect(0, 356, 78, 368)) then
  95.       set inCast to "NavBar2_GoBack"
  96.       set outCast to "NavBar2"
  97.       set cmd to "DoGoBackButton"
  98.     else
  99.       if inside(mousePos, rect(80, 356, 162, 368)) then
  100.         set inCast to "NavBar2_Menu"
  101.         set outCast to "NavBar2"
  102.         set cmd to "DoMenuButton"
  103.       else
  104.         if inside(mousePos, rect(164, 356, 238, 368)) then
  105.           set inCast to "NavBar2_Pause"
  106.           set outCast to "NavBar2"
  107.           set cmd to "DoPauseButton"
  108.         else
  109.           if inside(mousePos, rect(239, 356, 318, 368)) then
  110.             set inCast to "NavBar2_TryIt"
  111.             set outCast to "NavBar2"
  112.             set cmd to "DoTryItButton"
  113.           end if
  114.         end if
  115.       end if
  116.     end if
  117.   else
  118.     if inside(mousePos, rect(0, 356, 78, 368)) then
  119.       set inCast to "NavBar1_GoBack"
  120.       set outCast to "NavBar1"
  121.       set cmd to "DoGoBackButton"
  122.     else
  123.       if inside(mousePos, rect(80, 356, 162, 368)) then
  124.         set inCast to "NavBar1_Menu"
  125.         set outCast to "NavBar1"
  126.         set cmd to "DoMenuButton"
  127.       else
  128.         if inside(mousePos, rect(164, 356, 238, 368)) then
  129.           set inCast to "NavBar1_Pause"
  130.           set outCast to "NavBar1"
  131.           set cmd to "DoPauseButton"
  132.         else
  133.           if inside(mousePos, rect(239, 356, 318, 368)) then
  134.             set inCast to "NavBar1_GoNext"
  135.             set outCast to "NavBar1"
  136.             set cmd to "DoGoNextButton"
  137.           end if
  138.         end if
  139.       end if
  140.     end if
  141.   end if
  142.   if inCast <> EMPTY then
  143.     set hit to DoButtonHit(#be_pushButton, the clickOn, inCast, outCast, cmd, EMPTY, EMPTY, "mdown.aif", "mdown.aif", 0)
  144.     puppetSprite(the clickOn, 0)
  145.   end if
  146. end
  147.  
  148. on DoGoBackButton
  149.   set lessonNum to GG(#gLessonNum)
  150.   if GG(#gInTryIt) then
  151.     set labelName to GG(#gLessonPrefix) & "0"
  152.   else
  153.     set lessonList to GG(#gLessonList)
  154.     set pos to findPos(lessonList, lessonNum)
  155.     if pos <= 0 then
  156.       set pos to count(lessonList)
  157.     end if
  158.     set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
  159.   end if
  160.   ClearAutoChannelPuppets()
  161.   go(label(labelName))
  162.   if GG(#gInTryIt) then
  163.     DoGrowWindow()
  164.     setHiliteFlag(GG(#gActiveScroller), 1)
  165.     SG(#gInTryIt, 0)
  166.   end if
  167. end
  168.  
  169. on DoGoNextButton
  170.   set lessonNum to GG(#gLessonNum)
  171.   set lessonList to GG(#gLessonList)
  172.   set pos to findPos(lessonList, lessonNum)
  173.   set pos to pos + 1
  174.   if pos > count(lessonList) then
  175.     set pos to 1
  176.   end if
  177.   set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
  178.   ClearAutoChannelPuppets()
  179.   go(label(labelName))
  180.   if GG(#gInTryIt) then
  181.     DoGrowWindow()
  182.     setHiliteFlag(GG(#gActiveScroller), 1)
  183.     SG(#gInTryIt, 0)
  184.   end if
  185. end
  186.  
  187. on DoMenuButton
  188.   ClearAutoChannelPuppets()
  189.   set wind to MyTutorWindow()
  190.   SG(#gTutorWindow, wind)
  191.   if not voidp(wind) then
  192.     SG(#gBigDrawRect, rect(0, 0, 320, 364))
  193.     SG(#gDiffSize, 240)
  194.     DoShrinkWindow()
  195.   end if
  196.   go("Menu")
  197. end
  198.  
  199. on DoPauseButton
  200.   SG(#gPaused, not GG(#gPaused))
  201. end
  202.  
  203. on DoCloseButton
  204.   set pos to getSelectedLine(GG(#gActiveScroller))
  205.   set lessonList to GG(#gLessonList)
  206.   set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
  207.   ClearAutoChannelPuppets()
  208.   CG(#gLessonNum)
  209.   go(label(labelName))
  210.   DoGrowWindow()
  211. end
  212.  
  213. on DoTryItButton
  214.   set wind to MyTutorWindow()
  215.   SG(#gTutorWindow, wind)
  216.   if not voidp(wind) then
  217.     SG(#gBigDrawRect, rect(0, 0, 320, 364))
  218.     SG(#gDiffSize, 240)
  219.     DoShrinkWindow()
  220.   end if
  221.   set lessonList to GG(#gLessonList)
  222.   set nextFrame to getaProp(getaProp(lessonList, GG(#gLessonNum)), #tryItFrame)
  223.   go(nextFrame)
  224.   setHiliteFlag(GG(#gActiveScroller), 0)
  225.   dataChanged(GG(#gActiveScroller))
  226.   SG(#gInTryIt, 1)
  227. end
  228.  
  229. on DoShrinkWindow
  230.   set wind to GG(#gTutorWindow)
  231.   if not voidp(wind) then
  232.     set diffSize to GG(#gDiffSize)
  233.     if getAt(the drawRect of wind, 2) >= 0 then
  234.       set the rect of wind to the rect of wind + rect(0, diffSize, 0, 0)
  235.       set the drawRect of wind to the drawRect of wind - rect(0, diffSize, 0, diffSize)
  236.     end if
  237.     SG(#gIsSmallWindow, 1)
  238.   end if
  239. end
  240.  
  241. on DoGrowWindow
  242.   set wind to GG(#gTutorWindow)
  243.   if not voidp(wind) then
  244.     set diffSize to GG(#gDiffSize)
  245.     if getAt(the drawRect of wind, 2) < 0 then
  246.       set the rect of wind to the rect of wind - rect(0, diffSize, 0, 0)
  247.       set the drawRect of wind to the drawRect of wind + rect(0, diffSize, 0, diffSize)
  248.     end if
  249.     SG(#gIsSmallWindow, 0)
  250.   end if
  251. end
  252.